package santiago.domain;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class Node implements Serializable {

    private Map<CardinalPoint, Canal> Canals;
    private Map<CardinalPoint, Lot> Lots;
    private boolean Spring;

    public Node(Canal NorthCanal, Canal EastCanal, Canal SouthCanal, Canal WestCanal, Lot NorthEastLot, Lot SouthEastLot, Lot SouthWestLot, Lot NorthWestLot) {
        Canals = new HashMap<>();
        Lots = new HashMap<>();
        Spring = false;

        Canals.put(CardinalPoint.NORTH, NorthCanal);
        Canals.put(CardinalPoint.EAST, EastCanal);
        Canals.put(CardinalPoint.SOUTH, SouthCanal);
        Canals.put(CardinalPoint.WEST, WestCanal);

        Lots.put(CardinalPoint.NORTH_EAST, NorthEastLot);
        Lots.put(CardinalPoint.SOUTH_EAST, SouthEastLot);
        Lots.put(CardinalPoint.NORTH_WEST, NorthWestLot);
        Lots.put(CardinalPoint.SOUTH_WEST, SouthWestLot);
    }

    public void defineAsSpring() {
        Spring = true;
    }

    public boolean isSpring() {
        return Spring;
    }

    public Canal getCanal(CardinalPoint Location) {
        return Canals.get(Location);
    }

    public Lot getLot(CardinalPoint Location) {
        return Lots.get(Location);
    }
}
